package com.atguigu.lease.common.minio;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Ahmad
 * @date 2024/12/22 16:57
 * @description 配置类：管理、创建 MinIoClient对象
 */
@Configuration
public class MinIoConfig {
    @Autowired
    private MinioProperties minIoProperties;


    //登录minio
    @Bean
    public MinioClient minIoClient() {
        return MinioClient.builder()
                .endpoint(minIoProperties.getEndpoint())
                .credentials(minIoProperties.getAccessKey(), minIoProperties.getSecretKey()).build();
    }
}